function CalendarEvent(id, start, end, location, calendarId, subject, note, allDay) {
	this.id = id;
	this.start = start;
	this.end = end;
	this.location = location;
	this.calendarId = calendarId;
	this.subject = subject;
	this.note = note;
	this.allDay = allDay;
};

CalendarEvent.prototype.toString = function() {
  return "CalendarEvent id " + this.id + ", subject: " + this.subject;
}

CalendarEvent.prototype.getDashboardTitle = function() {
	var thisStartDate = new Date(this.getEventStart());
	var thisEndDate = new Date(this.getEventEnd());
	var formatStartDate = Mojo.Format.formatRelativeDate(thisStartDate, "medium");
	var formatEndDate = Mojo.Format.formatRelativeDate(thisEndDate, "medium");
	if (this.allDay) {
		if (formatStartDate == formatEndDate) {
			return formatStartDate;
		}
		else {
			return formatStartDate + " - " + formatEndDate;
		}
	}
	else {
		return formatStartDate + ", " +
			Mojo.Format.formatDate(thisStartDate, {time: "short"});
	}
}

CalendarEvent.prototype.getDashboardMessage = function() {
	return this.subject;
}

CalendarEvent.prototype.getShortId = function() {
	return CalendarEvent.getShortId(this.id);
}

CalendarEvent.prototype.getEventStart = function() {
	return CalendarEvent.getEventStart(this.id);
}

CalendarEvent.prototype.getEventEnd = function() {
	return CalendarEvent.getEventEnd(this.id);
}


// static helper methods
CalendarEvent.getShortId = function(id) {
	var end = id.indexOf("-");
	return id.substring(0, end);
}

CalendarEvent.getEventStart = function(id) {
	var start = id.indexOf("-");
	var end = id.lastIndexOf("-");
	return parseInt(id.substring(start + 1, end));
}

CalendarEvent.getEventEnd = function(id) {
	var start = id.lastIndexOf("-");
	var end = id.length;
	return parseInt(id.substring(start + 1, end));
}

/*
properties of result of 
new Mojo.Service.Request('palm://com.palm.calendar', {
				method: 'getEvent',
				parameters: {
					id: thisEvent.id,
					subscribe: false,
				},
				onSuccess: this.getEventSuccess.bind(this, thisEvent),
				onFailure: function(result){
					// event is gone, so delete it
					Mojo.Log.info("--- AppAssistant.discardOldCalendarEvents: event is gone: " + thisEvent.subject);
					appController.closeStage(thisEvent.id);
				}
			});

property: parentId, value: 0
property: originalTimestamp, value: 0
property: floating, value: false
property: reminderLongId, value: 48378511622147-1273827600000-1273831200000
property: subject, value: Ereignis 1
property: endValidity, value: 0
property: alarm, value: none
property: note, value: Einige notizen ueber einen langen langen text mit vielen zeichen
property: timeZoneId, value: Europe/Berlin
property: startTimestamp, value: 1273827600000
property: location, value: hierundda
property: attendees, value:
property: calendarId, value: id47278999994376
property: id, value: 48378511622147
property: endTimestamp, value: 1273831200000
property: allDay, value: false
property: backupID, value: 16793409746674
*/

/*
properties of result of 
new Mojo.Service.Request('palm://com.palm.calendar', {
			method: 'getEvents',
			parameters: {
				"calendarId": "all",
				"startDate": this.nowUTC,
				"endDate": this.thenUTC,
				"subscribe": false,
				"freeTimes": true
			},
			onSuccess: this.gotMyEvents.bind(this),
			onFailure: function(resp){
				Mojo.Log.info("Failure!!!!!!! " + resp.errorCode + " " + resp.errorText);
				Mojo.Controller.errorDialog("Failure!!!!!!! Cannot read Events.");

property: start, value: 1274220000000 // start of today's part of event
property: subject, value: NOCH ein ereignis
property: end_decimal, value: 1000
property: alarm, value: -PT15M
property: note, value: Und wieder ganz viele notizen   Fd Df D F Fdf Sedf Sd F Sdf Dfs F Sdf
property: isRecurringForever, value: false
property: start_decimal, value: 0
property: location, value:
property: overlap_count, value: 1
property: calendarId, value: id47278999994376
property: overlap_index, value: 0
property: id, value: 48378511622149-1274166000000-1274256000000 // id-eventStart-eventEnd
property: end, value: 1274256000000 // end of today's part of event
property: allDay, value: false
*/
